﻿using System;
using System.Collections.Specialized;
using System.IO;
using System.Security.Principal;
using System.Text;
using System.Web;

namespace RoketSolutions.SP2010.Infrostructure.UI.Ajax.Abstractions
{
    public class RequestWrapper
    {
        public RequestWrapper(HttpRequest request)
        {
            HttpRequest = request;
        }

        public RequestWrapper()
        {
            
        }

        public HttpRequest HttpRequest { get; set; }

        #region / Wrapped Properties /

        public virtual string this[string key]
        {
            get { return HttpRequest[key]; }
        }

        public virtual NameValueCollection Form
        {
            get { return HttpRequest.Form; }
        }

        #endregion

        #region / Properties /

        public string[] AcceptTypes
        {
            get { return HttpRequest.AcceptTypes; }
        }

        public string AnonymousID
        {
            get { return HttpRequest.AnonymousID; }
        }

        public string ApplicationPath
        {
            get { return HttpRequest.ApplicationPath; }
        }

        public string AppRelativeCurrentExecutionFilePath
        {
            get { return HttpRequest.AppRelativeCurrentExecutionFilePath; }
        }

        public HttpBrowserCapabilities Browser
        {
            get { return HttpRequest.Browser; }
        }

        public HttpClientCertificate ClientCertificate
        {
            get { return HttpRequest.ClientCertificate; }
        }

        public Encoding ContentEncoding
        {
            get { return HttpRequest.ContentEncoding; }
            set { HttpRequest.ContentEncoding = value; }
        }

        public int ContentLength
        {
            get { return HttpRequest.ContentLength; }
        }

        public string ContentType
        {
            get { return HttpRequest.ContentType; }
            set { HttpRequest.ContentType = value; }
        }

        public HttpCookieCollection Cookies
        {
            get { return HttpRequest.Cookies; }
        }

        public string CurrentExecutionFilePath
        {
            get { return HttpRequest.CurrentExecutionFilePath; }
        }

        public string FilePath
        {
            get { return HttpRequest.FilePath; }
        }

        public HttpFileCollection Files
        {
            get { return HttpRequest.Files; }
        }

        public Stream Filter
        {
            get { return HttpRequest.Filter; }
            set { HttpRequest.Filter = value; }
        }

        public NameValueCollection Headers
        {
            get { return HttpRequest.Headers; }
        }

        public string HttpMethod
        {
            get { return HttpRequest.HttpMethod; }
        }

        public Stream InputStream
        {
            get { return HttpRequest.InputStream; }
        }

        public bool IsAuthenticated
        {
            get { return HttpRequest.IsAuthenticated; }
        }

        public bool IsLocal
        {
            get { return HttpRequest.IsLocal; }
        }

        public bool IsSecureConnection
        {
            get { return HttpRequest.IsSecureConnection; }
        }

        public WindowsIdentity LogonUserIdentity
        {
            get { return HttpRequest.LogonUserIdentity; }
        }

        public NameValueCollection Params
        {
            get { return HttpRequest.Params; }
        }

        public string Path
        {
            get { return HttpRequest.Path; }
        }

        public string PathInfo
        {
            get { return HttpRequest.PathInfo; }
        }

        public string PhysicalApplicationPath
        {
            get { return HttpRequest.PhysicalApplicationPath; }
        }

        public string PhysicalPath
        {
            get { return HttpRequest.PhysicalPath; }
        }

        public NameValueCollection QueryString
        {
            get { return HttpRequest.QueryString; }
        }

        public string RawUrl
        {
            get { return HttpRequest.RawUrl; }
        }

        public string RequestType
        {
            get { return HttpRequest.RequestType; }
            set { HttpRequest.RequestType = value; }
        }

        public NameValueCollection ServerVariables
        {
            get { return HttpRequest.ServerVariables; }
        }

        public int TotalBytes
        {
            get { return HttpRequest.TotalBytes; }
        }

        public Uri Url
        {
            get { return HttpRequest.Url; }
        }

        public Uri UrlReferrer
        {
            get { return HttpRequest.UrlReferrer; }
        }

        public string UserAgent
        {
            get { return HttpRequest.UserAgent; }
        }

        public string UserHostAddress
        {
            get { return HttpRequest.UserHostAddress; }
        }

        public string UserHostName
        {
            get { return HttpRequest.UserHostName; }
        }

        public string[] UserLanguages
        {
            get { return HttpRequest.UserLanguages; }
        }

        #endregion

        #region / Methods /

        public virtual byte[] BinaryRead(int count)
        {
            return HttpRequest.BinaryRead(count);
        }

        public virtual int[] MapImageCoordinates(string imageFieldName)
        {
            return HttpRequest.MapImageCoordinates(imageFieldName);
        }

        public virtual string MapPath(string virtualPath)
        {
            return HttpRequest.MapPath(virtualPath);
        }

        public virtual string MapPath(string virtualPath, string baseVirtualDir, bool allowCrossAppMapping)
        {
            return HttpRequest.MapPath(virtualPath, baseVirtualDir, allowCrossAppMapping);
        }

        public virtual void SaveAs(string filename, bool includeHeaders)
        {
            HttpRequest.SaveAs(filename, includeHeaders);
        }

        public virtual void ValidateInput()
        {
            HttpRequest.ValidateInput();
        }

        #endregion

    }
}